package cn.bluethink.timescaledb.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Repository
@Mapper
public interface DBHelpMapper {

    /**
     * 根据表名判断表是否存在 当且仅当表不存在返回0
     * @param tableName
     * @return
     */
    Integer tableIsExit(@Param("tableName") String tableName);

    void createTable(@Param("tableName") String tableName, @Param("keys") List<String> keys);

    void insertBatch(Map<String,Object> paramMap);

    void createHyperTable(@Param("tableName") String tableName,@Param("timeType")String timeType);

    ArrayList<String> getColumnNamesByTableName(@Param("tableName") String tableName);

    void createTableByOType(@Param("tableName") String tableName, @Param("columns") Map<String, String> columns);

    void insertDynamicData(Map<String,Object> paramMap);

    Integer getCountByTableName(@Param("tableName") String tableName);

}
